<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>for-of</title>
</head>
<body>
    
</body>
<script>
    var arr = ['java','c++','php'];
    for(let item of arr){
        console.log(item);
    }

    //遍历装对象的数组
    var arr = [{name:'tom',age:'18'},{name:'jerry',age:'19'},{name:'rose',age:'17'}];
    for(let item of arr){
          console.log("打印对象：",item) //对象拼接 字符串的时候，不要使用+来拼接
    }

    //for-of不能遍历对象
    var student = {name:'tom',age:'23',sex:'男'};
    for(let item of student){
        console.log(item);//Uncaught TypeError: student is not iterable
    }
</script>
</html>